﻿<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" id="viewport">
		<title>首页-迅泊达</title>
		<link rel="shortcut icon" href="favicon.ico"/>
		<link rel="stylesheet" href="css/base.css" />
		<link rel="stylesheet" href="css/index.css" />
		<script src="js/jquery-1.11.2.min.js"></script>
		<script src="js/TouchSlide.1.1.js"></script>
		<script src="js/51size.js"></script>
		<script src="js/xbddai.js"></script>
		<script src="js/base.js"></script>
	</head>
	<body>
		<!--头部开始-->
		<header>
			<div class="header clearfix">
				<ul>
					<li><a href="index.html">首页</a></li>
					<li></li>
					<li><a id="href" href="login.html">登录</a></li>
				</ul>
			</div>
		</header>
		<!--头部结束-->
		
		<!--banner 轮播开始-->
		<div class="banner">
			<div id="focus" class="focus">
				<div class="hd">
					<ul></ul>
				</div>
				<div class="bd">
					<ul>
							<li><a href="#"><img _src="img/banner1.gif"  /></a></li>
							<li><a href="#"><img _src="img/banner1.gif" /></a></li>
							<li><a href="#"><img _src="img/banner1.gif" /></a></li>
					</ul>
				</div>
			</div>
			<script type="text/javascript">
				TouchSlide({ 
					slideCell:"#focus",
					titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
					mainCell:".bd ul", 
					effect:"left", 
					autoPlay:true,//自动播放
					autoPage:true, //自动分页
					switchLoad:"_src" //切换加载，真实图片路径为"_src" 
				});
			</script>
		</div>
		<!--banner  轮播结束-->
		<!--主体部分   开始-->
		<main id="content">
		
			
		</main>
		<!--主体部分   结束-->
		<footer>
			<a class="move">查看更多</a>
			<div class="indormation">
				<a href="latest-announcement.html" class="first">
					<span><img src="img/notice.png" alt="" /></span>
					<em>最新公告</em>
				</a>
			</div>
			<div class="footer">
				<p>武汉迅泊达金融服务有限公司</p>
				<p>鄂ICP备13010359</p>
			</div>
		</footer>
	</body>	
<script type="text/javascript">
var pageIndex = 1;
window.onload=function(){

	var uid=localStorage.getItem("uid");
	if(uid!=null){
		var phone=localStorage.getItem("phone");
		$("#href").html(phone);
		$("#href").attr("href","my-account.html");
	}

	//加載借款标列表
	$.ajax({
		type: 'POST',
		url:  baseUrl+'/app/borrow/list',
		async: false,
		success: function(result) {
			console.log(result);
			if(result.code == -1){
				var html="";
				for(var i=0;i<result.entity.pageList.length;i++){
					var entity=result.entity.pageList[i];
					var util="";
					if("MONTH"==entity.dateUtil){
						util="个月";
					}else{
						util="天";
					}
					var amount=entity.amount/10000+"万";
					html+="<div class='one index-base1' data-id='"+entity.id+"'>"+
							"<a>"+
								"<div class='text clearfix'>"+
									"<ul>"+
										"<li><img src='img/car.gif' alt='' /></li>"+
										"<li>"+entity.title+"</li>"+
										"<li><em>保</em><em>车</em><em>担</em></li>"+
										"<li>"+formatDateYMD(new Date(entity.createTime))+"</li>"+
									"</ul>"+
								"</div>"+
								"<div class='data'>"+
									"<ul class='clearfix'>"+
										"<li>"+
											"<p>年化率</p>"+
											"<span>"+entity.percent+"%</span>"+
										"</li>"+
										"<li>"+
											"<p>金额</p>"+
											"<span>"+amount+"</span>"+
										"</li>"+
										"<li>"+
											"<p>期限</p>"+
											"<span>"+entity.deadline+""+util+"<span>"+
										"</li>"+
										"<li>"+
											"<div class='circle'>"+
												"<canvas id='annularOne' width='200' height='200' style='width:6rem;height=6rem'></canvas>"+
											"</div>"+
										"</li>"+
									"</ul>"+
								"</div>"+
							"</a>"+
						"</div>";
				}

				$("#content").html(html);

			}else{
				alert("数据加载异常...")
			}
		}
	});

	$(".index-base1").click(function(){
		var data_id=$(this).attr("data-id");
		localStorage.setItem("borrow_id",data_id);
		window.location.href="loan.html";
	})
}
$(".move").click(function(){
	$.ajax({
		type: 'POST',
		url:  baseUrl+'/app/borrow/list',
		data:{
			index:++pageIndex
		},
		async: false,
		success: function(result) {
			if(result.code == -1) {
				var html = "";
				if (result.entity.pageList.length > 0) {
					for(var i=0;i<result.entity.pageList.length;i++){
						var entity=result.entity.pageList[i];
						var util="";
						if("MONTH"==entity.dateUtil){
							util="个月";
						}else{
							util="天";
						}
						var amount=entity.amount/10000+"万";
						html+="<div class='one index-base1' data-id='"+entity.id+"'>"+
								"<a>"+
								"<div class='text clearfix'>"+
								"<ul>"+
								"<li><img src='img/car.gif' alt='' /></li>"+
								"<li>"+entity.title+"</li>"+
								"<li><em>保</em><em>车</em><em>担</em></li>"+
								"<li>"+formatDateYMD(new Date(entity.createTime))+"</li>"+
								"</ul>"+
								"</div>"+
								"<div class='data'>"+
								"<ul class='clearfix'>"+
								"<li>"+
								"<p>年化率</p>"+
								"<span>"+entity.percent+"%</span>"+
								"</li>"+
								"<li>"+
								"<p>金额</p>"+
								"<span>"+amount+"</span>"+
								"</li>"+
								"<li>"+
								"<p>期限</p>"+
								"<span>"+entity.deadline+""+util+"<span>"+
								"</li>"+
								"<li>"+
								"<div class='circle'>"+
								"<canvas id='annularOne' width='200' height='200' style='width:6rem;height=6rem'></canvas>"+
								"</div>"+
								"</li>"+
								"</ul>"+
								"</div>"+
								"</a>"+
								"</div>";
					}
					$("#content").append(html);
				}else{
					html='<div style="margin-bottom: 0.6rem;text-align: center;"><span style="font-size: 1.3em;">没有更多数据</span></div>';
					$("#content").append(html);
					$(".move").remove();
				}
			}else {
				alert("数据加载异常...")
			}
		}
	});
});
</script>
</html>
